package com.abel.repository.helper;

import com.abel.datamodel.type.Applicants;
import com.abel.domain.DesiredPosition;
import com.abel.domain.HelpfulInformation;
import com.abel.domain.OptionalInformation;
import com.abel.domain.PersonProfile;
import com.abel.domain.PersonalInformation;

public class DataConverter {

	public PersonProfile convertApplicantsToPersonProfile(Applicants applicants) {
		
		PersonProfile personProfile = new PersonProfile();
		
		PersonalInformation personalInformation = new PersonalInformation();
		personalInformation.setSsn(applicants.getAplSsn());
		personalInformation.setFirstName(applicants.getAplFirstName());
		personalInformation.setMiddleName(applicants.getAplMiddleName());
		personalInformation.setLastName(applicants.getAplLastMame());
		personalInformation.setAddressLine1(applicants.getAplAddrLine1());
		personalInformation.setAddressLine2(applicants.getAplAddrLine2());
		personalInformation.setCity(applicants.getAplCity());
		personalInformation.setZip(applicants.getAplZip());
		personalInformation.setState(applicants.getAplState());
		personalInformation.setHomePhone(applicants.getAplHomePhone());
		personalInformation.setAlternatePhone(applicants.getAplAlternatePhone());
		personalInformation.setWorkPhone(applicants.getAplWorkPhone());
		personalInformation.setEmergencyContact(applicants.getAplEmergencyName());
		personalInformation.setEmergencyContactPhone(applicants.getAplemergencyPhone());
		personalInformation.setEmergencyContactRelation(applicants.getAplemergencyRelation());
		personalInformation.setDateOfBirth(applicants.getAplBirthDate());
		personalInformation.setCreateDate(applicants.getAplCreateDts());
		personalInformation.setLastUpdateDate(applicants.getAplLastUpdateDts());
		personProfile.setPersonalInformation(personalInformation);
		
		OptionalInformation optionalInformation = new OptionalInformation();
		optionalInformation.setHeight(applicants.getAplHeight());
		optionalInformation.setWeight(applicants.getAplWeight());
		optionalInformation.setMaritalStatus(applicants.getAplMaritalStatus());
		optionalInformation.setChildrensAges(applicants.getAplChildrenAges());
		personProfile.setOptionalInformation(optionalInformation);
		
		HelpfulInformation helpfulInformation = new HelpfulInformation();
		helpfulInformation.setAccessToCar(applicants.getAplCarAccessYn());
		helpfulInformation.setWillingToRelocate(applicants.getAplRelocateYn());
		helpfulInformation.setTravelPercentage(applicants.getAplTravelPct());
		helpfulInformation.setWillingToTravel(applicants.getAplTravelYn());
		helpfulInformation.setEmployed(applicants.getAplEmployedYn());
		personProfile.setHelpfulInformation(helpfulInformation);
		
		DesiredPosition desiredPosition = new DesiredPosition();
		desiredPosition.setPosition1stDesired(applicants.getAplPositionDesired1());
		desiredPosition.setPosition2ndDesired(applicants.getAplPositionDesired2());
		desiredPosition.setSalaryDesired(applicants.getAplSalaryDesired());
		desiredPosition.setLeastSalaryAccepted(applicants.getAplMinimumSalary());
		desiredPosition.setSalaryMode(applicants.getAplSalaryDesiredMd());
		desiredPosition.setLeastSalaryMode(applicants.getAplMinimumSalaryMd());
		personProfile.setDesiredPosition(desiredPosition);
		
		return personProfile;
	}
	
}
